#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   item.py
@Time    :   2024-07-09 13:01:52
@Author  :   chakcy 
@Email   :   947105045@qq.com
@description   :   redis Item 操作类
'''

from typing import Any, List

import aioredis

class Item:
    """Redis Item 操作类"""
    def __init__(self, redis: aioredis.Redis):
        # 初始化 Redis 连接
        self.redis = redis
    async def get_value(self, key: str) -> str:
        """获取指定键的值"""
        return await self.redis.get(key) 
    async def set_value(self, key: str, value: str) -> Any:
        """设置指定键的值"""
        return await self.redis.set(key, value)  
    async def delete_value(self, key: str) -> Any:
        """删除指定键的值"""
        return await self.redis.delete(key) 
    async def get_all_keys(self) -> List[Any]:
        """获取所有键"""
        return await self.redis.keys() 